package cn.edu.hunau.java.week03.day02;

import java.util.Objects;

public class Rice {
        private String variety;       // 品种
        private String origin;        // 原产地
        private double height;        // 高度(单位：米)
        private int growthDays;       // 生长天数
        private String color;         // 颜色
        private double yieldPerAcre;  // 每亩产量(单位：公斤)
        private boolean isHybrid;     // 是否为杂交品种

    public Rice() {
    }

    public Rice(String variety, String origin, double height, int growthDays) {
        this.variety = variety;
        this.origin = origin;
        this.height = height;
        this.growthDays = growthDays;
    }

    public String getVariety() {
        return variety;
    }

    public void setVariety(String variety) {
        this.variety = variety;
    }

    public String getOrigin(String 湖南) {
        return origin;
    }

    public void setOrigin(String origin) {
        this.origin = origin;
    }

    public double getHeight() {
        return height;
    }

    public void setHeight(double height) {
        this.height = height;
    }

    public int getGrowthDays() {
        return growthDays;
    }

    public void setGrowthDays(int growthDays) {
        this.growthDays = growthDays;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public double getYieldPerAcre() {
        return yieldPerAcre;
    }

    public void setYieldPerAcre(double yieldPerAcre) {
        this.yieldPerAcre = yieldPerAcre;
    }

    public boolean isHybrid() {
        return isHybrid;
    }

    public void setHybrid(boolean hybrid) {
        isHybrid = hybrid;
    }

    @Override
    public String toString() {
        return "Rice{" +
                "variety='" + variety + '\'' +
                ", origin='" + origin + '\'' +
                ", height=" + height +
                ", growthDays=" + growthDays +
                ", color='" + color + '\'' +
                ", yieldPerAcre=" + yieldPerAcre +
                ", isHybrid=" + isHybrid +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (o == null || getClass() != o.getClass()) return false;
        Rice rice = (Rice) o;
        return Double.compare(height, rice.height) == 0 && growthDays == rice.growthDays && Double.compare(yieldPerAcre, rice.yieldPerAcre) == 0 && isHybrid == rice.isHybrid && Objects.equals(variety, rice.variety) && Objects.equals(origin, rice.origin) && Objects.equals(color, rice.color);
    }

    @Override
    public int hashCode() {
        return Objects.hash(variety, origin, height, growthDays, color, yieldPerAcre, isHybrid);
    }
}
